package pack0602;

import java.util.Scanner;
//有一个作业提交系统,需要学生输入邮箱号和作业名称(java作业以.java结尾),
//来完善当前系统,验证用户名是否符合邮箱规则,作业是否是java作业.
public class DemoF {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("输入邮箱号:  ");
        String a = in.next();
        int a1 = a.indexOf("@"); //@的索引位置
        int a2 = a.indexOf(".");
        System.out.println(a1);
        System.out.println(a2);

        System.out.println("作业名称:  ");
        String b = in.next();
        boolean b1 = b.endsWith(".java");

        if (b1 && a1 != -1 && a2 != -1 && a2 > a1) {
            System.out.println("正确");
        } else {

            System.out.println("错误");
        }
    }
}
